﻿import com.dinmax.flash.gsa.sgs.game.*
import com.dinmax.flash.gsa.communication.*
import com.dinmax.flash.gsa.sgs.state.*
import com.dinmax.flash.gsa.sgs.*

class Enabled extends State {

	private var games:SGSGames;
	
	public function isEnabled():Boolean {
		return true;
	}
	
	public function setGames(games:SGSGames):Void {
		//trace("Enabled.as | setGames "+games);
		this.games=games;
	}; //fin función
	
	public function getGames():SGSGames {
		//trace("Enabled.as | getGames "+games);
		return games;
	}
	
	public function getGame(key:String):Game {
		return games.getItem(key);
	}
	
	
	public function init():Boolean {
		
		try	{
			if(!games){
			//trace("Enabled.as | 31 | los juegos están indefinidos");
			Communication.getActive().getGames();	
			}
			//Setear los games a los valores enteros.
			return true;
		} catch (e) {
			
			trace("Enabled.as | init() | error= "+e);
			return false;
		}
				
	}

} // fin de la clase